package com.example.demo.kafka.service;

import com.example.demo.kafka.entity.User;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.kafka.annotation.KafkaListener;
import org.springframework.stereotype.Service;

/**
 * Created by ssd on 2018/6/15.
 */
@Service
public class KafkaService {
    Logger logger= LoggerFactory.getLogger(KafkaService.class);
    int i=0;
    @KafkaListener(topics = "myTopics2",groupId = "test2")
    public void consumer(String user){
        i++;
       logger.info("groupId = test2,接受到消息{}:{}",i,user);

    }
}
